\(\int \frac {1}{1-\cos ^2(x)} \, dx\) [25]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 4 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\cot (x) \]

[Out]

-cot(x)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 4, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3254, 3852, 8} \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\cot (x) \]

[In]

Int[(1 - Cos[x]^2)^(-1),x]

[Out]

-Cot[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3254

Int[(u_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Dist[a^p, Int[ActivateTrig[u*cos[e + f*x
]^(2*p)], x], x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a + b, 0] && IntegerQ[p]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps \begin{align*} \text {integral}& = \int \csc ^2(x) \, dx \\ & = -\text {Subst}(\int 1 \, dx,x,\cot (x)) \\ & = -\cot (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 4, normalized size of antiderivative = 1.00 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\cot (x) \]

[In]

Integrate[(1 - Cos[x]^2)^(-1),x]

[Out]

-Cot[x]

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.25

method result size
parallelrisch \(-\cot \left (x \right )\) \(5\)
default \(-\frac {1}{\tan \left (x \right )}\) \(7\)
risch \(-\frac {2 i}{{\mathrm e}^{2 i x}-1}\) \(13\)
norman \(\frac {-\frac {1}{2}+\frac {\left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{2}}{\tan \left (\frac {x}{2}\right )}\) \(18\)

[In]

int(1/(1-cos(x)^2),x,method=_RETURNVERBOSE)

[Out]

-cot(x)

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 8, normalized size of antiderivative = 2.00 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\frac {\cos \left (x\right )}{\sin \left (x\right )} \]

[In]

integrate(1/(1-cos(x)^2),x, algorithm="fricas")

[Out]

-cos(x)/sin(x)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 14 vs. \(2 (3) = 6\).

Time = 0.28 (sec) , antiderivative size = 14, normalized size of antiderivative = 3.50 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=\frac {\tan {\left (\frac {x}{2} \right )}}{2} - \frac {1}{2 \tan {\left (\frac {x}{2} \right )}} \]

[In]

integrate(1/(1-cos(x)**2),x)

[Out]

tan(x/2)/2 - 1/(2*tan(x/2))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.50 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\frac {1}{\tan \left (x\right )} \]

[In]

integrate(1/(1-cos(x)^2),x, algorithm="maxima")

[Out]

-1/tan(x)

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.50 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\frac {1}{\tan \left (x\right )} \]

[In]

integrate(1/(1-cos(x)^2),x, algorithm="giac")

[Out]

-1/tan(x)

Mupad [B] (verification not implemented)

Time = 2.66 (sec) , antiderivative size = 4, normalized size of antiderivative = 1.00 \[ \int \frac {1}{1-\cos ^2(x)} \, dx=-\mathrm {cot}\left (x\right ) \]

[In]

int(-1/(cos(x)^2 - 1),x)

[Out]

-cot(x)